package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.mapper.IBaseUserMapper;
import com.kaili.basic.pojo.dto.MdmUserAddDto;
import com.kaili.basic.pojo.dto.MdmUserQueryDto;
import com.kaili.basic.pojo.entity.MdmUserExport;
import com.kaili.basic.pojo.entity.MdmUserQueryEntity;
import com.kaili.basic.pojo.vo.MdmUserVO;
import com.kaili.basic.service.IBaseUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by linjian on 19-8-1.
 */
@Service
public class IBaseUserServiceImpl implements IBaseUserService {

    @Autowired
    private IBaseUserMapper iBaseUserMapper;

    @Override
    public Page<MdmUserQueryEntity> getBaseUsersByConditions(Page<MdmUserQueryEntity> page, MdmUserQueryDto baseUser) {
        List<MdmUserQueryEntity> list = iBaseUserMapper.getBaseUsersByConditions(page,baseUser);
        return page.setRecords(list);
    }

    @Override
    public MdmUserVO queryUserByUserName(String userName) {
        return iBaseUserMapper.queryUserByUserName(userName);
    }

    @Override
    public List<MdmUserExport> usersInfoExport(MdmUserQueryDto dto) {
        return iBaseUserMapper.usersInfoExport(dto);
    }

    @Override
    public void addNewUser(MdmUserVO mdmUserVO) {
        iBaseUserMapper.addNewUser(mdmUserVO);
    }

    @Override
    public void doCreateUser(MdmUserAddDto dto) {
        iBaseUserMapper.doCreateUser(dto);
    }

    @Override
    public void updateUser(MdmUserVO mdmUserVO) {
        iBaseUserMapper.updateUser(mdmUserVO);
    }

    @Override
    public void updateRdStatusEnable(Integer id) {
        iBaseUserMapper.updateRdStatusEnable(id);
    }

    @Override
    public void updateRdStatusDisable(Integer id) {
        iBaseUserMapper.updateRdStatusDisable(id);
    }

    @Override
    public void deleteUserById(Integer id) {
        iBaseUserMapper.deleteUserById(id);
    }

    @Override
    public MdmUserQueryEntity getBaseUsersById(Integer id) {
        return iBaseUserMapper.getBaseUsersById(id);
    }
}
